package github.saw96x.config;

import lombok.*;

/**
 * @author Saw96x
 * @date 2022/3/18 8:30
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Builder
@ToString
public class RpcServiceConfig {
  /**
   * 服务版本
   */
  private String version = "";
  /**
   * when the interface has multiple implementation classes, distinguish by group
   */
  private String group = "";

  /**
   * 目标服务
   */
  private Object service;

  public String getRpcServiceName() {
    return this.getServiceName() + this.getGroup() + this.getVersion();
  }

  public String getServiceName() {
    return this.service.getClass().getInterfaces()[0].getCanonicalName();
  }
}
